package com.apicloud.moduleAlarmTimer;

import com.uzmap.pkg.uzcore.uzmodule.UZModuleContext;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class PollingService extends Service {

	public static final String ACTION = "com.ryantang.service.PollingService";

	public static UZModuleContext context = null;
	private static int cnt = 0;

	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}

	@Override
	public void onStart(Intent intent, int startId) {
		new PollingThread().start();
	}

	class PollingThread extends Thread {
		@Override
		public void run() {
			System.out.println("wakeup times: " + cnt);
			if (context != null) {
				context.success("wakeup times:" + cnt++, false, false);
			}
		}
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		System.out.println("Service:onDestroy");
	}
}
